package com.shanzmoo.db.store.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.shanzmoo.db.store.entity.StoreMemberEntity;
import com.shanzmoo.db.store.entity.bo.StoreMemberSelectBO;
import com.shanzmoo.db.store.entity.vo.StoreMemberVO;
import com.shanzmoo.db.store.entity.query.StoreMemberQuery;
import com.shanzmoo.db.store.mapper.StoreMemberMapper;
import com.shanzmoo.db.store.service.IStoreMemberService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * 仓储客户 服务实现类
 *
 * @author Gzhao 2021-03-08
 */
@Service
public class StoreMemberServiceImpl extends ServiceImpl<StoreMemberMapper, StoreMemberEntity>
        implements IStoreMemberService {

    @Override
    public List<StoreMemberVO> queryPageList(StoreMemberQuery query) {
        return baseMapper.queryPageList(query);
    }

    @Override
    public List<StoreMemberSelectBO> getSelectList() {
        List<StoreMemberEntity> list = baseMapper.selectList(
                new QueryWrapper<StoreMemberEntity>()
                        .eq("deleted", false)
        );
        return list.stream().map(StoreMemberSelectBO::createByEntity).collect(Collectors.toList());
    }
}
